package com.example.helloword;

import android.os.Bundle
import android.widget.Button
import android.widget.ImageView
import android.widget.TextView
import androidx.activity.ComponentActivity

class MyActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?){
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val textView = findViewById<TextView>(R.id.textView)
        val button = findViewById<Button>(R.id.button)
        val imageView = findViewById<ImageView>(R.id.imageView)

        //初显示Hello World！
        textView.text = getString(R.string.textView)
        //点击后
        button.setOnClickListener {
            textView.text = getString(R.string.clicked)
            imageView.setImageResource(R.drawable.flag)
        }

    }
}